Billy.Zheng [Tue, 5 Apr 2022 11:45:47 +0000 (19:45 +0800)]
Update invocation for out-of-box dart ls support
* eglot.el (eglot-server-programs): Tweak dart-mode entry.
* README.md: Tweak Dart entry.
Co-authored-by: João Távora
Copyright-paperwork-exempt: Yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/862
João Távora [Mon, 4 Apr 2022 10:05:29 +0000 (11:05 +0100)]
Check textdocumentsync/willsave cap before sending it
* eglot.el (eglot--guess-contact): Default language-id to educated
guess when eglot--lookup-mode returns nil.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/823
João Távora [Mon, 4 Apr 2022 09:41:29 +0000 (10:41 +0100)]
Guess language-id if manually entering server program
* eglot.el (eglot--guess-contact): Default language-id to educated
guess when eglot--lookup-mode returns nil.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/837
João Távora [Mon, 4 Apr 2022 09:23:56 +0000 (10:23 +0100)]
Tweak eglot mode-line menus
* eglot.el (eglot-manual): Rename from eglot-read-documentation
(eglot-customize): Delete.
(eglot-menu): Rename from eglot-menu-map. Rework.
(eglot--mode-line-format): Tweak.
(eglot-menu-string): Rename from eglot-mode-line-string.
(Flymake customization): New source section.
* NEWS.md: Tweak.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/792
Felicián Németh [Sat, 15 Jan 2022 17:51:36 +0000 (18:51 +0100)]
Rework eglot's mode-line
Mimic flymake by replacing the old menus of the mode-line with
"context menus". List all usefull commands under the main menu
(eglot-menu-map), and commands related to LSP debugging under the
project menu (eglot-debug-map).
* eglot.el (eglot-read-documentation, eglot-customize): New
commands.
(eglot-mode-line-string): New defcustom.
(eglot-menu-map, eglot-debug-map,): New variables.
(eglot--mode-line-props): Rework to use eglot-menu-map and
eglot-debug-map.
(eglot--mode-line-format): Use eglot-mode-line-string.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/792
João Távora [Mon, 4 Apr 2022 08:39:59 +0000 (09:39 +0100)]
Make eglot--plist-keys a simple (non-map.el) helper again
This removes a nagging compilation warning when developing on Emacs
master.
There's not much point in depending on map.el just for this util. And
there' snot much point in making eglot--plist-keys go through a
generic dispatching mechanism when we happen to know the thing
being dispatched
* eglot.el (eglot--plist-keys): Define in helpers section.
João Távora [Thu, 31 Mar 2022 13:21:29 +0000 (14:21 +0100)]
Protect against empty firsttriggercharacter strings
Which some LS's like gopls like to send.
* eglot.el (eglot--post-self-insert-hook): Beware of empty strings.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/906
João Távora [Mon, 28 Mar 2022 10:00:44 +0000 (11:00 +0100)]
Easier initializationoptions in eglot-server-programs
Per https://github.com/joaotavora/eglot/issues/845.
* NEWS.md: Update.
* eglot.el (eglot-server-programs): Document new syntax.
(eglot-initialization-options): Can use initializationOptions from
server's saved initargs.
(eglot--connect): Allow a plist to be appended to a server
contact.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/901
João Távora [Mon, 28 Mar 2022 23:09:34 +0000 (00:09 +0100)]
Tweak on-type-formatting code
* eglot.el (eglot--post-self-insert-hook): Tweak.
(eglot-format): Tweak docstring.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/899
Felicián Németh [Wed, 23 Mar 2022 20:47:45 +0000 (21:47 +0100)]
Implement on-type-formatting support
* eglot.el (eglot-format): Add new optional argument `on-type-format'
to request :textDocument/onTypeFormatting, and ...
(eglot--post-self-insert-hook): ... call it from here when necessary.
* eglot-tests.el (eglot--simulate-key-event): New helper defun.
(rust-on-type-formatting): New test.
* NEWS.md: mention feature.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/899
Felicián Németh [Sun, 27 Mar 2022 20:58:44 +0000 (22:58 +0200)]
Map more emacs variables to lsp formattingoptions fields
* eglot.el (eglot-format): Map require-final-newline to
insertFinalNewline and delete-trailing-lines to trimFinalNewlines.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/900
Marcus Swanson [Sat, 26 Mar 2022 21:43:31 +0000 (22:43 +0100)]
Add omnisharp support for c#
* eglot.el (eglot-server-programs): Add omnisharp for C#.
* README.md: Document the above change.
Copyright-paperwork-exempt: Yes
GitHub-reference: close https://github.com/joaotavora/eglot/issues/897
João Távora [Thu, 24 Mar 2022 16:06:08 +0000 (16:06 +0000)]
Use bounds of thing at point when asking for code actions
* eglot.el (eglot--region-bounds): Consider bounds of things at
point.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/895
Felicián Németh [Sun, 20 Mar 2022 08:50:15 +0000 (09:50 +0100)]
Add simple support for workspacefolders
Close https://github.com/joaotavora/eglot/issues/893.
Clients can support workspaceFolders since LSP 3.6. rootUri and
rootPath are deprecated. Dynamic changes in folders are not
supported, i.e., this patch does not implement
workspace/didChangeWorkspaceFolders.
* eglot.el (eglot-client-capabilities): Add capability
`workspaceFolders'.
(eglot-workspace-folders): New cl-defgeneric.
(eglot--connect): Add workspaceFolders to initializeParams.
(eglot-handle-request workspace/workspaceFolders): New cl-defmethod.
João Távora [Fri, 18 Mar 2022 10:54:21 +0000 (10:54 +0000)]
Defend against broken move-to-column in recent emacs
* eglot.el (eglot-lsp-abiding-column): Use (min (point) (point-max))
This is a defensive fix for an Emacs/company-mode problem described
below.
The problem can be reproduced in Eglot before this commit with:
~/Source/Emacs/emacs/src/emacs -Q -f package-initialize -L \
~/Source/Emacs/company-mode -l company -f global-company-mode -l \
eglot.el ~/tmp/issue-860/args_out_of_range.c -f eglot -f \
display-line-numbers-mode -f toggle-debug-on-error
1 // args_out_of_range.c
2 struct Book {
3 int id;
4 char title[50]
5 } book = { 1024, "C" };
6
7 int main(int argc, char *argv[])
8 {
9
10 // Error when typing the dot to make "book."
11 book
12 return 0;
13 }
When one types the dot after the "book" on line 11, company-mode
displays a two-line overlay that visually encompasses line 12 after
"book", which has the "return 0;" statement. That line happens to
also hold a warning about incorrect syntax, one that starts at column
2.
Eglot uses 'move-to-column' to go that precise place.
In Emacs 27.2, move-to-column is unaffected by previous company-mode
overlays, even if the current line is being co-used visually by the
overlay. It moves to the right buffer position.
In Emacs master, this isn't true. It seems to be confounded by the
company-mode overlay and moves to eob, which eventually breaks Eglot
with a backtrace such as this one:
Debugger entered--Lisp error: (args-out-of-range #<buffer args_out_of_range.c> 110 124)
encode-coding-region(110 124 utf-16 t)
(length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t))
(- (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t)) 2)
(/ (- (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t)) 2) 2)
eglot-lsp-abiding-column(110)
(- column (eglot-lsp-abiding-column lbp))
(setq diff (- column (eglot-lsp-abiding-column lbp)))
(progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff)))
(while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil))
(let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil)
(catch '--cl-block-nil-- (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil))
(save-restriction (catch '--cl-block-nil-- (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if ... ... ...) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil)))
eglot-move-to-lsp-abiding-column(2)
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/860
João Távora [Tue, 15 Mar 2022 10:20:24 +0000 (10:20 +0000)]
Don't advertise didchangewatchedfiles on tramp
* eglot.el (eglot--trampish-p): New helper.
(eglot-client-capabilities): Use it.
(eglot--uri-to-path): Use it.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/883
Felicián Németh [Sat, 12 Mar 2022 09:57:53 +0000 (10:57 +0100)]
Change capability 'documentchanges' to t
Eglot does support woskspaceEdit/documentChanges, but failed to
advertise this fact.
Per https://github.com/joaotavora/eglot/issues/873.
* eglot.el (eglot-client-capabilities): Set documentChanges to t.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/853
Manuel Uberti [Fri, 11 Mar 2022 12:41:53 +0000 (13:41 +0100)]
Use new jdtls script for eclipse jdt
Per https://github.com/joaotavora/eglot/issues/864.
* eglot.el (eglot-server-programs): use new jdtls
(eglot--eclipse-jdt-contact, eglot--eclipse-jdt). Remove.
(eglot-execute-command eglot-eclipse-jdt): Remove.
(eglot-initialization-options eglot-eclipse-jdt): Remove.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/863
Augusto Stoffel [Thu, 10 Mar 2022 11:32:20 +0000 (12:32 +0100)]
Don't strip invisible text when formatting hover string
This was introduced in https://github.com/joaotavora/eglot/issues/482 due to a bad interaction with a specific
server. But this solution makes hyperlinks in Eldoc buffers
unclickable, because the markdown-mode function that visits a link
relies on the invisible text.
Per https://github.com/joaotavora/eglot/issues/866
* eglot.el (eglot--format-markup): Use buffer-string instead of
filter-buffer-substring
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/865
João Távora [Sun, 6 Mar 2022 11:15:18 +0000 (11:15 +0000)]
Have a couple of lsp faces inherit from basic "shadow"
* eglot.el (eglot-diagnostic-tag-unnecessary-face)
(eglot-diagnostic-tag-deprecated-face): Inherit from 'shadow'.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/858
Brian Leung [Tue, 1 Mar 2022 15:59:05 +0000 (07:59 -0800)]
Prevent empty diagnostic tags vector hiding main fontification
* eglot.el (eglot-handle-notification): Require that the resulting
list of faces is non-empty and that each face corresponds only to a
known tag.
For unknown tags, we don't pass any additional face information to
Flymake, and instead expect it to make the appropriate overlay with
the "severity" property of the Diagnostic.
Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/851
Brian Leung [Sun, 23 Jan 2022 03:59:06 +0000 (19:59 -0800)]
Properly check the completionitem.deprecated property
* eglot.el (eglot-completion-at-point): Check the :deprecated property
is `t'. We do this so that a :deprecated property of :json-false does
not cause a completion candidate to be incorrectly marked as deprecated.
Stefan Kangas [Sat, 22 Jan 2022 03:40:12 +0000 (04:40 +0100)]
* eglot.el (eglot-handle-notification): silence byte-compiler.
Brian Leung [Thu, 13 Jan 2022 03:06:18 +0000 (19:06 -0800)]
Add support for optional completionitem.tags
* eglot.el (eglot--lsp-interface-alist): Add optional CompletionItem.tags.
(eglot-completion-at-point): Add :company-deprecated key and value,
checking for either the appropriate tag (1) in the :tags property, or
a truthy value for the :deprecated property.
(eglot-client-capabilities): Advertise tagSupport (for tag == 1) and
deprecatedSupport.
Also load an updated version of seq.el in Emacsen < 27.
* Makefile (ELPA_DEPS): Require latest seq.el.
Stefan Kangas [Sat, 22 Jan 2022 03:13:11 +0000 (04:13 +0100)]
Don't use :exclusive no
See https://github.com/joaotavora/eglot/issues/812 for background, in particular:
https://github.com/joaotavora/eglot/issues/812#issuecomment-
1014821345
* eglot.el (eglot-completion-at-point): Don't use :exclusive no, as it
leads to breakage in many cases.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/812
Theodor Thornhill [Thu, 20 Jan 2022 22:06:53 +0000 (23:06 +0100)]
Enable lsp project-wide diagnostics via flymake
* eglot.el (eglot-handle-notification): Pass on diagnostics from
unvisited files to flymake. Enables project-wide-diagnostics, so that
we can view all diagnostics in a given workspace. Uses new
functionality from flymake 1.2.1, hence the version bump.
* eglot-tests.el (project-wide-diagnostics-typescript): New tests
showcasing the possibility to see all related diagnostics in a
workspace.
* eglot-tests.el (project-wide-diagnostics-rust-analyzer): New tests
showcasing the possibility to see all related diagnostics in a
workspace.
* NEWS.md: Mention the new functionality
* README.md: Mention the new functionality
Derek Passen [Wed, 19 Jan 2022 01:56:13 +0000 (19:56 -0600)]
Add clojure-lsp support for clojure
* eglot.el (eglot-server-programs): Add clojure-lsp for Clojure.
* README.md: Document the above change.
Copyright-paperwork-exempt: Yes
Stefan Kangas [Mon, 17 Jan 2022 22:32:50 +0000 (23:32 +0100)]
; fix thinko in last commit
Stefan Kangas [Fri, 14 Jan 2022 12:03:44 +0000 (13:03 +0100)]
Change rust language server to rust-analyzer
rust-analyzer is the officially blessed Language Server for Rust:
https://github.com/rust-lang/rfcs/pull/2912
Also drop the special support code for RLS.
* eglot.el (eglot-server-programs): Add rust-mode language server
"rust-analyzer" and prefer it to the older "rls".
(eglot-rls, jsonrpc-connection-ready-p)
(eglot-handle-notification): Delete special support for "rls".
* eglot-tests.el (rls-analyzer-watches-files)
(rls-analyzer-hover-after-edit): Rename to ...
(rust-analyzer-watches-files)
(rust-analyzer-hover-after-edit): ... this. Update tests to work
with rust-analyzer.
* README.md: Update references for RLS to point to rust-analyzer.
* NEWS.md: Announce above change.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/803
Stefan Kangas [Sun, 16 Jan 2022 13:13:05 +0000 (14:13 +0100)]
; unbreak tests on emacs 26
* eglot.el (eglot--plist-keys): Define in Emacs 26, no longer
obsolete in Emacs 27 or later.
(eglot--check-object): Go back to eglot--plist-keys.
Stefan Kangas [Sun, 16 Jan 2022 12:05:16 +0000 (13:05 +0100)]
* eglot.el (eglot--server-capable): don't use obsolete name.
Stefan Kangas [Sun, 16 Jan 2022 12:05:13 +0000 (13:05 +0100)]
Obsolete eglot--plist-keys in favor of map-keys
* eglot.el (eglot--plist-keys): Make into obsolete function alias
for map-keys.
Stefan Kangas [Sun, 16 Jan 2022 12:04:27 +0000 (13:04 +0100)]
; * eglot.el: move obsolete definition to new section.
Stefan Kangas [Sat, 15 Jan 2022 23:12:05 +0000 (00:12 +0100)]
Remove unnecessary compatibility code
* eglot.el (eglot-mode-map): Remove unnecessary compatibility
code. We already depend on eldoc 0.11.0.
Stefan Kangas [Sat, 15 Jan 2022 16:37:42 +0000 (17:37 +0100)]
Improve backwards-compatibility of eglot-mode-map
* eglot.el (eglot-mode-map): Only bind to eldoc-doc-buffer in Emacs
28.1 or later.
Stefan Kangas [Sat, 15 Jan 2022 16:35:19 +0000 (17:35 +0100)]
* eglot.el (eglot-strict-mode): very minor docfix.
Stefan Kangas [Sat, 15 Jan 2022 12:47:30 +0000 (13:47 +0100)]
* eglot.el (eglot--connect): display seconds on timeout.
Stefan Kangas [Wed, 12 Jan 2022 23:50:35 +0000 (00:50 +0100)]
Print server command to events buffer
* eglot.el (eglot--connect): Print server command to events
buffer.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/476
Stefan Kangas [Thu, 13 Jan 2022 21:47:36 +0000 (22:47 +0100)]
; * eglot.el (eglot-server-initialized-hook): fix punctuation.
Theodor Thornhill [Mon, 30 Dec 2019 15:26:22 +0000 (16:26 +0100)]
Change from symbol-at-point to thing-at-point
* eglot.el (eglot-rename): Change from symbol-at-point to
thing-at-point to avoid interning a symbol. Add "unknown symbol" to
prompt when no symbol is found.
Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: close https://github.com/joaotavora/eglot/issues/385
Brian Leung [Tue, 11 Jan 2022 05:48:21 +0000 (21:48 -0800)]
Support optional diagnostic.tags
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag
A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or
2 (DiagnosticTag.Deprecated). Following the rendering suggestions in
the protocol, we fade out Unnecessary code and strike-through
Deprecated code.
* eglot.el (eglot-diagnostic-tag-unnecessary-face)
(eglot-diagnostic-tag-deprecated-face): New faces.
(eglot--tag-faces): New defconst.
(eglot--lsp-interface-alist): Add Diagnostic.tags.
(eglot-client-capabilities): Advertise supported tags.
(eglot-handle-notification): Assign the appropriate properties.
* eglot-tests.el (diagnostic-tags-unnecessary-code): New test.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/794
Stefan Kangas [Thu, 13 Jan 2022 11:30:17 +0000 (12:30 +0100)]
* eglot.el: improve commentary section.
Stefan Kangas [Thu, 13 Jan 2022 10:52:29 +0000 (11:52 +0100)]
Support racket-langserver
* eglot.el (eglot-server-programs): Support racket-langserver.
* README.md:
* NEWS.md: Update for above changes.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/694
Stefan Kangas [Wed, 12 Jan 2022 18:35:22 +0000 (19:35 +0100)]
Bump eglot version to 1.8
* eglot.el (Version): Bump to 1.8.
* NEWS.md (1.8): Rename header from "(upcoming)".
Brian Leung [Tue, 11 Jan 2022 03:32:19 +0000 (19:32 -0800)]
Don't error out on unsupported diagnostic.codedescription
A codeDescription property is, at the time of writing, an object with
an href property (of type URI, or a string), denoting a "URI to open
with more information about the diagnostic error".
It's not obvious how best to put this into a Flymake diagostic
aside from simply appending it to the diagnostic message, so we'll
worry about it some other time.
* eglot.el (eglot--lsp-interface-alist)
(eglot-client-capabilities): Don't error out on unsupported
Diagnostic.codeDescription.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/768
Fredrik Bergroth [Wed, 15 Dec 2021 12:05:22 +0000 (13:05 +0100)]
Support autoimporttext from pyright language server
* eglot.el (eglot-completion-at-point): show autoImportText via company-docsig.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/769
Felicián Németh [Mon, 10 Jan 2022 19:21:21 +0000 (20:21 +0100)]
Add tooltip describing pending requests
* eglot.el (eglot--mode-line-format): Add tooltip to `pending'.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/784
Brian Leung [Sun, 9 Jan 2022 02:08:23 +0000 (18:08 -0800)]
Properly print error message of eglot-alternatives
* eglot.el (eglot-alternatives): Work with the listified form. This
allows presumed executables provided as (EXECUTABLE &rest ARGS...)
to be displayed in the error.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/786
Brian Leung [Sun, 9 Jan 2022 01:43:23 +0000 (17:43 -0800)]
Add up-to-date server executables for html/css/json
* README.md: Advertise updated executables.
* eglot.el (eglot-server-programs): Prioritize the alternatives.
The {html,css,json}-languageserver executables that are distributed
outside VS Code are not regularly updated by Microsoft; any relevant
updates to the VS Code source tree reach VS Code users without the
need for VS Code developers to go out of their way to publish new
versions of the executables. Consequently, users of other editors who
have been using the server executables from the most obvious NPM
packages are likely using stale versions.
@hrsh7th, a Vim user, created an NPM package with updated versions of these
executables taken straight from VS Code's source tree. We therefore
prefer to direct users to the corresponding repo, which contains
appropriate installation instructions, in the README.
Stefan Kangas [Sun, 9 Jan 2022 16:41:40 +0000 (17:41 +0100)]
; fix license statement
Packages in GNU ELPA are considered part of GNU Emacs.
Stefan Kangas [Sun, 9 Jan 2022 16:38:40 +0000 (17:38 +0100)]
; update copyright years
Brian Leung [Sun, 9 Jan 2022 02:30:57 +0000 (18:30 -0800)]
Add vim-language-server for vimrc-mode
* README.md: Advertise.
* eglot.el (eglot-server-programs): Add vim-language-server.
Brian Leung [Sun, 9 Jan 2022 02:27:29 +0000 (18:27 -0800)]
Add cmake-language-server for cmake-mode
* README.md: Advertise.
* eglot.el (eglot-server-programs): Add cmake-language-server.
Stefan Kangas [Sun, 9 Jan 2022 01:50:38 +0000 (02:50 +0100)]
Un-reverse references in xref buffer
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/763
Martin Carlson [Tue, 31 Aug 2021 10:24:34 +0000 (12:24 +0200)]
Add variable to withhold the init req process id
* eglot.el (eglot-withhold-process-id): New defvar.
(eglot--connect): Don't send pid to language server if above new
defvar has a non-nil value.
Copyright-paperwork-exempt: Yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/722
NA [Fri, 11 Jan 2019 03:58:04 +0000 (05:58 +0200)]
Support language server for html, css, json and docker
* eglot.el (eglot-server-programs): Support html-languageserver,
css-languageserver, json-languageserver, and docker-langserver.
* README.md: Update documentation for above changes.
Copyright-paperwork-exempt: Yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/204
Stefan Kangas [Sat, 8 Jan 2022 18:43:29 +0000 (19:43 +0100)]
Minor checkdoc fixes
* eglot.el (eglot, eglot--when-buffer-window, eglot--widening)
(eglot-initialization-options, eglot--current-flymake-report-fn)
(eglot-handle-notification, eglot-handle-request)
(eglot--highlight-piggyback, eglot-register-capability)
(eglot-unregister-capability):
* eglot-tests.el (auto-detect-running-server, auto-shutdown)
(auto-reconnect, eglot--tests-force-full-eldoc, rename-a-symbol)
(basic-completions, non-unique-completions, basic-xref)
(snippet-completions, snippet-completions-with-company)
(eglot-eldoc-after-completions, python-yapf-formatting)
(javascript-basic, json-basic, eglot-ensure)
(eglot--guessing-contact): Doc fixes; formatting.
* eglot.el (xref-backend-identifier-completion-table): Fix error
format.
Omar Polo [Mon, 30 Aug 2021 12:32:32 +0000 (12:32 +0000)]
Add lua-lsp support for lua-mode
* eglot.el (eglot-server-programs): Add support for the lua-lsp server for lua.
* README.md: Document the above change.
jgart [Sat, 2 Oct 2021 04:20:57 +0000 (00:20 -0400)]
Add support for the mint language server
* eglot.el (eglot-server-programs): Add support for the mint language server.
* README.md: Document the above change.
Copyright-paperwork-exempt: Yes
Illia Danko [Sat, 18 Sep 2021 12:13:39 +0000 (15:13 +0300)]
Add pyright language server support for python-mode
* eglot.el (eglot-server-programs): Add pyright support for
python-mode.
* README.md: Document the above change.
Copyright-paperwork-exempt: Yes
Stefan Kangas [Sat, 8 Jan 2022 17:18:16 +0000 (18:18 +0100)]
; fix typos
Philipp Edelmann [Wed, 13 May 2020 17:50:12 +0000 (11:50 -0600)]
Use fortls also for fortran-mode
* eglot.el (eglot-server-programs): Use fortls also for fortran-mode.
Copyright-paperwork-exempt: Yes
Brian Leung [Tue, 5 Oct 2021 05:39:12 +0000 (22:39 -0700)]
Add yaml-language-server for yaml-mode
* eglot.el (eglot-server-programs): Add yaml-language-server.
* README.md: Mention yaml-language-server.
lorniu/sz [Sun, 26 Dec 2021 10:37:14 +0000 (18:37 +0800)]
Use `locate-user-emacs-file` instead of `concat`
* eglot.el (eglot--eclipse-jdt-contact): Use locate-user-emacs-file.
Copyright-paperwork-exempt: Yes
Stefan Kangas [Sat, 8 Jan 2022 15:02:06 +0000 (16:02 +0100)]
; prefer https to http addresses
Fredrik Bergroth [Wed, 15 Dec 2021 21:31:20 +0000 (22:31 +0100)]
Add missing entries from completionitemkind
* eglot.el (eglot--kind-names): update
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/772
Garret Buell [Wed, 15 Dec 2021 21:17:26 +0000 (13:17 -0800)]
Mark eglot-completion-at-point capf "non-exclusive"
Add :exclusive 'no to eglot-completion-at-point results marking it as
non-exclusive. This will allow completion to fall back to other less precise
completion backends (e.g. dabbrev) if Eglot's returns no results.
* eglot.el (eglot-completion-at-point): Set :exclusive to 'no
Copyright-paperwork-exempt: Yes
GitHub-reference: close https://github.com/joaotavora/eglot/issues/770
Stephen Leake [Tue, 16 Nov 2021 08:23:39 +0000 (00:23 -0800)]
Merge pull request from stephe-ada-guru/master
Fix issues https://github.com/joaotavora/eglot/issues/755, https://github.com/joaotavora/eglot/issues/401; severity not set in textDocument/publishDiagnostics
GitHub-reference: https://github.com/joaotavora/eglot/issues/759
Stephen Leake [Sat, 13 Nov 2021 10:39:59 +0000 (02:39 -0800)]
Fix issues; severity not set in textdocument/publishdiagnostics
* eglot.el (eglot-handle-notification): Handle severity not set.
GitHub-reference: https://github.com/joaotavora/eglot/issues/755
GitHub-reference: https://github.com/joaotavora/eglot/issues/401
Ingo Lohmar [Sat, 9 Oct 2021 19:19:37 +0000 (21:19 +0200)]
Fix workspace/configuration handling when given scopeuri directory
The path returned by eglot--uri-to-path is mostly used for file paths,
and therefore does not end with a slash. Such a no-trailing-slash path
violates what default-directory demands (per its docstring), which
causes hack-dir-local-variables-non-file-buffer to not find the
appropriate dir-local vars.
João Távora [Sun, 5 Sep 2021 19:05:45 +0000 (20:05 +0100)]
Fixup last commit
Per https://github.com/joaotavora/eglot/issues/726.
I'm still not entirely convinced using all-completion here is a good
idea. As usual the completion list we get from the server is
pre-filtered to whatever the server wishes. Letting the completion
style do its own filtering (most completion styles use
completion-regexp-list and all-completions themselves) is completely
useless here.
Let's hope it's not harmful.
* eglot.el (eglot-completion-at-point): Fix all-completions call
João Távora [Sun, 5 Sep 2021 08:44:27 +0000 (09:44 +0100)]
Respect completion-regexp-alist in eglot's completion table
See GitHub discussion https://github.com/joaotavora/eglot/issues/726
Suggested-by: Felicián Németh <felician.nemeth@gmail.com>
Suggested-by: JD Smith
* eglot (eglot-completion-at-point): use all-completions.
João Távora [Wed, 1 Sep 2021 09:17:24 +0000 (10:17 +0100)]
Fix typo in user-visible eglot-ignored-server-capabilities
The name with the typo, eglot-ignored-server-capabilites, is still
supported.
Per https://github.com/joaotavora/eglot/issues/724.
* NEWS.md: Mention change
* eglot.el (eglot-ignored-server-capabilities): New defcustom.
João Távora [Tue, 17 Aug 2021 09:12:27 +0000 (10:12 +0100)]
Fall back to prompting user if eglot-alternatives fails
* eglot.el (eglot-alternatives): Don't error in interactive case.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/719
João Távora [Tue, 10 Aug 2021 19:28:35 +0000 (20:28 +0100)]
Let eglot-flymake-backend be in flymake-d-functions even if eglot off
This is useful when using eglot-stay-out-of and a pattern like:
(defun my/js-mode-hook ()
(add-hook 'flymake-diagnostic-functions 'some-eslint-backend nil t))
(setq-local eglot-stay-out-of '(flymake))
(add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t))
(add-hook 'js-mode-hook 'my/js-mode-hook)
Then, _both_ backends will run unconditionally, but Eglot backend only
actually reports diagnostics if Eglot is on.
* eglot.el (eglot-flymake-backend): If buffer isn't being managed
by Eglot, behave as a noop.
Brian Leung [Sun, 31 Jan 2021 01:33:08 +0000 (17:33 -0800)]
Add support for locationlink
Fix https://github.com/joaotavora/eglot/issues/711.
LocationLink was added in version 3.14 of the protocol and is
sometimes used in lieu of Location for definition- and
reference-related requests.
* eglot.el (eglot--lsp-interface-alist): Update with LocationLink.
(eglot-client-capabilities): Advertise
textDocument.{definition,declaration,implementation,typeDefinition}.linkSupport.
(eglot--lsp-xrefs-for-method): Accept LocationLinks.
Co-authored-by: João Távora <joaotavora@gmail.com
GitHub-reference: close https://github.com/joaotavora/eglot/issues/712
João Távora [Sun, 13 Jun 2021 22:07:42 +0000 (23:07 +0100)]
Transpose order of "pylsp" and "pyls" alternatives
When operating remotely, searching for an executable that don't exist
takes longer than usual. Better to put the most likely server first
in the list to minimize the slowdown.
* eglot.el (eglot-server-programs): Transpose python mode alternatives
GitHub-reference: per https://github.com/joaotavora/eglot/issues/703
João Távora [Sun, 13 Jun 2021 09:55:24 +0000 (10:55 +0100)]
Don't call eglot--executable-find more than needed
* eglot.el (eglot-alternatives): Complexify.
(eglot--guess-contact): No need to 'executable-find' if path
absolute.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/703
Liu Hui [Fri, 11 Jun 2021 22:49:19 +0000 (06:49 +0800)]
Consider tramp in eglot-alternatives
* eglot.el (eglot-alternatives): Use eglot--executable-find.
Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/702
João Távora [Wed, 26 May 2021 17:51:30 +0000 (18:51 +0100)]
Use project-files to know which directory watchers to skip
The directory-finding logic is probably a bit slower than using
eglot--directories-recursively, but since it honours `.gitignores` and
ignores more directories it's much faster overall. And guaranteed to
create less watchers.
Thanks to Dmitry Gutov <dgutov@yandex.ru> for the idea.
* eglot.el (eglot--directories-recursively): Remove.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/697
João Távora [Wed, 26 May 2021 14:23:29 +0000 (15:23 +0100)]
Hard code an exception to "node_modules" directores
* eglot.el (eglot--directories-recursively): Fix.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/697
GitHub-reference: per https://github.com/joaotavora/eglot/issues/645
João Távora [Wed, 26 May 2021 14:21:06 +0000 (15:21 +0100)]
Again speed up directory watching
Previously, given a number of globs, Eglot would try to place system
watchers only in those subdirectories that could potentially be
matched by a glob. This meant traversing the whole tree, which could
be impractical. Just place watchers in every subdirectory of the
project (you may run out of watchers).
* eglot.el (eglot-register-capability): Simplify.
(eglot--files-recursively): Delete.
(eglot--directories-recursively): Fix.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/697
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/645
João Távora [Sat, 22 May 2021 10:49:47 +0000 (11:49 +0100)]
Support multiple servers out-of-box for same mode
Also per https://github.com/joaotavora/eglot/issues/537.
* eglot.el (eglot-alternatives): new helper.
(eglot-server-programs): Use it. Use clangd and pylsp.
* NEWS.md: Mention feature.
* README.md (Connecting to a server): Mention pylsp and clangd.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/688
Augusto Stoffel [Sat, 22 May 2021 10:53:38 +0000 (12:53 +0200)]
Allow staying out of flymake-mode, eldoc-mode
* eglot.el (eglot--managed-mode): don't enable flymake or eldoc when
those symbols belong to eglot-stay-out-of.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/671
Michael Livshin [Sat, 15 Dec 2018 01:17:32 +0000 (01:17 +0000)]
Manage cross-referenced files outside project in same server
Close https://github.com/joaotavora/eglot/issues/686, Close https://github.com/joaotavora/eglot/issues/695.
Co-authored-by: João Távora <joaotavora@gmail.com>
* eglot.el (eglot-extend-to-xref): new defcustom, default to
nil.
(eglot--servers-by-xrefed-file): new hash table, mapping file names
to servers.
(eglot--managed-mode): use eglot-current-server, instead of
eglot--cached-server directly.
(eglot--current-server-or-lose): ditto.
(eglot--maybe-activate-editing-mode): ditto.
(eglot-current-server): move all cached-server update logic here -- if
eglot--cached-server is nil, try to find it using current project or
(optionally) xref location.
(eglot--xref-make-match): record the xref location.
* README.md (Customization): Mention new defcustom.
* NEWS.md: Mention new feature
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/76
Jim Porter [Thu, 13 May 2021 15:55:31 +0000 (08:55 -0700)]
Correct path/uri when using tramp from ms windows
Co-authored-by: João Távora <joaotavora@gmail.com>
* eglot.el (eglot--connect): Ensure drive letter doesn't sneak into
rootPath. (eglot--path-to-uri): Only add a leading "/" for local MS
Windows paths. (eglot--uri-to-path): Only remove leading "/" from
local MS Windows paths.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/679
João Távora [Thu, 13 May 2021 09:09:20 +0000 (10:09 +0100)]
Provide context for finer project-find-functions
* eglot.el (eglot--guess-contact): Use eglot--current-project.
(eglot): Adjust docstring.
(eglot-lsp-context): New variable.
(eglot--current-project): New helper.
(eglot--maybe-activate-editing-mode, eglot--eclipse-jdt-contact):
Use eglot--current-project.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/687
Steve Purcell [Fri, 30 Apr 2021 08:32:07 +0000 (20:32 +1200)]
Fix emacs 28 warning by avoiding positional args in define-minor-mode
* eglot.el (eglot--managed-mode): Avoid positional args.
Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: close https://github.com/joaotavora/eglot/issues/685
Steve Purcell [Thu, 29 Apr 2021 23:09:04 +0000 (11:09 +1200)]
Allow lsp languageid to be overridden via eglot-server-programs
Close https://github.com/joaotavora/eglot/issues/678. Per https://github.com/joaotavora/eglot/issues/677
* eglot-tests.el (eglot--guessing-contact): Add
GUESSED-LANG-ID-SYM param.
(eglot-server-programs-guess-lang): New test.
* eglot.el (eglot-server-programs): Augment entries for caml-mode
and tuareg-mode. Enhance docstring.
(eglot--lookup-mode): New helper.
(eglot--guess-contact): Call eglot--lookup-mode.
(eglot, eglot-reconnect): Pass language-id to eglot--connect
(eglot--connect): Receive LANGUAGE-ID
(eglot--TextDocumentItem): Simplify. Use
`eglot--current-server-or-lose'
* README.md (Handling quirky servers): Mention new feature.
Co-authored-by: João Távora <joaotavora@gmail.com>
Augusto Stoffel [Wed, 28 Apr 2021 10:41:19 +0000 (11:41 +0100)]
Add a completion-category-defaults entry
Setting completion-styles buffer-locally is harder to customize and
can break some completion UIs.
Emacs bughttps://github.com/joaotavora/eglot/issues/48073
* eglot.el: Add a completion-category-defaults entry, if applicable.
(eglot--managed-mode): Don't set `completion-styles'
(eglot-completion-at-point): Add style metadata to
completion table.
Steve Purcell [Sun, 25 Apr 2021 22:51:44 +0000 (10:51 +1200)]
Switch default langserver for ocaml to ocamllsp
The repo for ocaml-language-server has been archived and inactive
for quite some time:
https://github.com/ocaml-lsp/ocaml-language-server
Meanwhile, ocaml-lsp is the generally-preferred option, and is actively
maintained in the ocaml org itself:
https://github.com/ocaml/ocaml-lsp/
* eglot.el (eglot-server-programs): switch caml-mode entry.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/677
João Távora [Fri, 23 Apr 2021 07:49:02 +0000 (08:49 +0100)]
Declare eglot--cached-server before use
Per https://github.com/joaotavora/eglot/issues/670.
Otherwise the dynamic binding of it in in eglot--connect won't work.
* eglot.el (eglot--cached-server): Move up.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/673
João Távora [Tue, 20 Apr 2021 17:39:54 +0000 (18:39 +0100)]
Make eglot-current-server work in notification handlers
* eglot.el (eglot--connect): Ensure `eglot--cached-server` bound
when calling notification/request methods.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/670
João Távora [Tue, 13 Apr 2021 00:16:31 +0000 (01:16 +0100)]
Add a passing test demonstrating clangd + tramp works
... It works at least within the minimal, well-controlled reproducible
settings of this test. Maybe if we knew something more about the
setup of the user who submitted this report we would be able to
concoct a failing test, but we don't.
* eglot-tests.el (subr-x): Require it
(eglot--make-file-or-dir): Return expanded file name.
(eglot-tests--lsp-abiding-column-1): New helper.
(eglot-lsp-abiding-column): Use it.
(eglot--tramp-test): Fix `skip-unless` condition.
(eglot--tramp-test-2): New test.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/667
Dmitry Gutov [Mon, 12 Apr 2021 23:30:11 +0000 (02:30 +0300)]
Merge pull request from mohkale/company-kind
(feature): Add :company-kind to eglot-completion-at-point
GitHub-reference: https://github.com/joaotavora/eglot/issues/656
Mohsin Kaleem [Mon, 29 Mar 2021 21:32:33 +0000 (22:32 +0100)]
Add :company-kind to eglot-completion-at-point
* eglot.el (eglot-completion-at-point): Add a :company-kind field to the
completion-at-point function so that company can associate completion
candidates with lsp types.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/652
Mohsin Kaleem [Mon, 29 Mar 2021 21:17:07 +0000 (22:17 +0100)]
Highlight relevant part of xref hits using xref-match face
Also close https://github.com/joaotavora/eglot/issues/657.
(eglot--xref-make-match): Use face 'xref-match instead of 'highlight.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/650
João Távora [Sat, 10 Apr 2021 13:31:14 +0000 (14:31 +0100)]
Attempt to speed up initial directory/glob correspondence
In https://github.com/joaotavora/eglot/issues/602, not only a new glob processing system was implemented, but
also a new, more correct, way to look for directories that might hold
files matched by one of these globs.
Answering this question is important because the file watchers for
'workspace/didChangeWatchedFiles' are placed on a per-directory basis.
Previously, a glob such as /foo/**/bar/*.el would fail to produce
practical file-watching effects because /foo/**/bar/ isn't really a
directory.
However, answering this question is also expensive, as the globs sent
by the LSP server are meant to match files, not directories. The only
way is to list all files under the project's root directory and test
each glob on each one. If it matches at least one file, that file's
directory is meant to be watched.
We suspect that in https://github.com/joaotavora/eglot/issues/645 and https://github.com/joaotavora/eglot/issues/633 we are falling victim to LSP server
who serve a tremendous unoptimized number of globs, one for each file.
So instead of sending just '/foo/**/bar/*.el' they send
'/foo/**/bar/quux.el', '/foo/**/bar/quuz.el', etc... which would
tremendeously slow down the process. But this is only a suspicion.
This commit tries some simple optimizations: if a directory is known
to be watch-worthy becasue one of its files matched a single glob, no
more files under that directory are tried. This should help somewhat.
Also fixed a bug in 'eglot--files-recursively', though I suspect that
doesn't make that much of a difference.
* eglot.el (eglot--directories-matched-by-globs): New helper.
(eglot--files-recursively): Fix bug.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/645
João Távora [Thu, 1 Apr 2021 23:21:27 +0000 (00:21 +0100)]
Generalize eglot-flymake-backend
Loosen coupling between eglot-flymake-backend and flymake-mode. The
flymake-mode check in 'eglot-handle-notification publishDiagnostics'
was a hack (and it wasn't even functioning correctly on M-x
eglot-shutdown/eglot-reconnect).
This should also allow eglot-flymake-backend to be driven by
diagnostic-annotating frontends other than Flymake, such as the
popular Flycheck package.
* eglot.el (eglot--managed-mode): Use eglot--report-to-flymake.
(eglot-handle-notification textDocument/publishDiagnostics): Use
eglot--report-to-flymake.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/596
rvs314 [Fri, 26 Mar 2021 10:08:03 +0000 (06:08 -0400)]
Offer better control over "languageid" value sent to lsp
Handles the issue of languages whose major mode has a
different name than the name that the LSP server expects for
the language. One can now:
(put 'favourite-major-mode 'eglot-language-id "foobarbaz")
And "foobarbaz" will be used as the LSP "languageId" value.
* eglot.el (eglot--TextDocumentItem): Consult 'eglot-language-id.
Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/525